import fetch from '@/utils/fetch'

export function addGoodsClassify(data) {
  return fetch({
    url: '/add/goods/classify',
    method: 'post',
    data: {
      data
    }
  })
}




export function delGoodsDiscount(id) {
  return fetch({
    url: '/delete/goods/discount',
    method: 'get',
    params: {
      id
    }
  })
}

export function addGoodsDiscount(discount) {
  return fetch({
    url: '/add/goods/support',
    method: 'post',
    data: {
      discount
    }
  })
}





export function getClassify(id, offset) {
  return fetch({
    url: '/get/classify',
    method: 'get',
    params: {
      id,
      offset
    }
  })
}


export function getGoodsInfo(id) {
  return fetch({
    url: '/get/goods/info',
    method: 'get',
    params: {
      id
    }
  })
}

export function updateGoodsInfo(goods_id, infos, tags, imgs) {
  return fetch({
    url: '/update/goods/info',
    method: 'post',
    data: {
      goods_id, 
      infos, 
      tags, 
      imgs
    }
  })
}



export function deleteGoodsClassify(id) {
  return fetch({
    url: '/delete/goods/classify',
    method: 'get',
    params: {
      id
    }
  })
}

export function updateGoodsClassify(data) {
  return fetch({
    url: '/update/goods/classify',
    method: 'post',
    data: {
      data

    }
  })
}

export function getGoods(id, offset, keyword, classify) {
  return fetch({
    url: '/get/goods',
    method: 'get',
    params: {
      id,
      offset,
      keyword,
      classify
    }
  })
}

export function deleteGoods(id) {
  return fetch({
    url: '/delete/goods',
    method: 'get',
    params: {
      id
    }
  })
}

export function getGoodsImg(id) {
  return fetch({
    url: '/get/goods/img',
    method: 'get',
    params: {
      id
    }
  })
}


export function delGoodsImg(id) {
  return fetch({
    url: '/delete/goods/img',
    method: 'get',
    params: {
      id
    }
  })
}



export function getGoodsSupport(id) {
  return fetch({
    url: '/get/goods/support',
    method: 'get',
    params: {
      id
    }
  })
}


export function addGoods(content, discount) {
  return fetch({
    url: '/add/goods',
    method: 'post',
    data: {
      content,
      discount
    }
  })
}

export function updateGoodsDiscount(discount) {
  return fetch({
    url: '/update/goods/support',
    method: 'post',
    data: {
      discount
    }
  })
}

export function updateGoods(content, infos, tags) {
  return fetch({
    url: '/update/goods',
    method: 'post',
    data: {
      content,
      infos,
      tags
    }
  })
}




export function addGoodsImg(img) {
  return fetch({
    url: '/add/goods/img',
    method: 'post',
    data: {
      img
    }
  })
}



